include io.asm

stack segment stack
	dw 128 dup (?)
stack ends

;;======================================================================
data segment
	Head db "Vasilenko Anatoly. Group 111.$"
	Input db "Enter please number: $"
	Output db "Answer: $"
data ends
;;======================================================================

code segment 'code'
	assume ss:stack, ds:data, cs:code
start:
	mov ax,data
	mov ds,ax
	lea dx, Head
	outstr
	newline
	newline
	;;------------------------------------------------------------------
		lea dx, Input;
		outstr;
		
		inint ax;
		mov bx, 10;
		mov dx, 0;
		div bx;
		mov si, dx; last number
		mov di, dx; first number
		
		L:	cmp ax, 0;
			je short continue;
			mov dx, 0;
			div bx;
			mov di, dx;
			jmp L;
	
	continue:
		mov ax, si;
		mul di;
		
		lea dx, Output;
		outstr;
		outword ax;
	
	;;------------------------------------------------------------------

the_end:
	newline;
	newline;
	mov ah,8
	int 21h
    finish
code ends

;;======================================================================
end start 

;;======================================================================
